#ifndef __MONKEY_H__
#define __MONKEY_H__

#include "cocos-ext.h"
#include "cocos2d.h"
#include "Config.h"

USING_NS_CC;
USING_NS_CC_EXT;
using namespace cocos2d::gui;


class Monkey : public CCNode
{
public:
	// Khoi tao con khi voi CCNode
	static Monkey * create(CCNode* node);
	bool init(CCNode* node);
	virtual void update(float dt); // update cac action khi trang thai thay doi

	void fPreLoadMusic();

	// Getter, Setter cua con khi
	inline void fSetHeath(int numheath){mHeath = numheath;};
	inline int fGetHeath(){return mHeath;};

	// Setter vi tri cua con khi
	void fSetPosition(float x, float y);
	void fSetPosition(CCPoint point);
	CCPoint fGetPosition();

	// Setter, Geteter trang thai hien tai cua con khi
	inline void setStatus(MonkeyStatus status) {mNewStatus = status;}
	inline int getStatus() {return mCurrentStatus;}

	// Setter, Geteter trang thai xoay ben phai hay ben trai cua cay
	inline void setDirection(MonkeyDirection direction) {mNewDirection = direction;}
	inline int getDirection() {return mCurrentDirection;}

	

	// Tra ve amature cua con khi CCNode->Armature
	CCArmature* fGetArmature();

	// MONKEY ACTION
	// Xoay chieu cho con khi
	void fChangeDirection();
	// Quan ly cac hieu ung chuyen dong cua con khi
	void fEffect();

private:

	void onAnimationEvent(CCArmature *pArmature, MovementEventType eventType, const char *animationID); // quan ly cac trang thai cua animation

	CCArmature* mArmature;
	CCArmatureAnimation* mAnimation;
	int mHeath;
	int mDirection;
	float mScale;
	// Cac trang thai cua con khi
	MonkeyStatus mCurrentStatus;
	MonkeyStatus mNewStatus;

	MonkeyDirection mCurrentDirection;
	MonkeyDirection mNewDirection;
};

#endif //Khi con